const mysql = require("mysql");

const connection = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: 'root',
  database: 'dbtest'  //是几个圆饼图标的数据库的名字，不是有小鲸鱼图标连接m名
});
connection.connect()

var modSql = 'UPDATE emp SET name = ? WHERE id =? ';
//where id跟前面的参数不加逗号
var modSqlParams = ["争光",1]

//改
connection.query(modSql,modSqlParams,function (err, result) {
  if (err) {
    console.log(err.message);
    
    // console.log('[UPDATE ERROR] -', err.massage);
     return;
  }
  console.log(result);
})
connection.end()